1. Field of the Invention
The present invention relates to a texture drawing device used in computer graphics (CG), and, in particular, to a texture address generator, a texture pattern generator, a texture drawing device, and a texture address generating method used for generating texture patterns during texture mapping process.
2. Description of the Prior Art
In a texture mapping process frequently used in computer graphics (CG) and the like, when a pixel is written into a memory or a display, coordinates are exchanged by using a coordinate (X',Y) as a position of a relevant pixel in a display coordinate system and by using a Z-position corresponding to the relevant pixel in a perspective coordinate system. Then, an address for a model coordinate system is generated and texture data is read out so that the relevant pixel is brightly reflected.
The coordinate exchange process in this type of the textured mapping process is illustrated as follows.
When the respective coordinates are set as follows:
Texture coordinates: (X, Y) PA1 Word coordinates: (X', Y', Z') PA1 Perspective coordinates: (X", Y", Z") PA1 Display coordinates: (X", Y") PA1 X'=(R.times.X")/(R+Z") (perspective reverse transformation) PA1 Y'=(R.times.Y")/(R+Z") PA1 Z'=(R.times.Z")/(R+Z") PA1 X=a.times.X'+d.times.Y'+g.times.Z'+1 (affin transformation) PA1 Y=b.times.X'+e.times.Y'+h.times.Z'+m PA1 first storage means for storing an n-th cycle texture address; PA1 second storage means for storing an increment for the n-th cycle texture address; PA1 third storage means for storing a constant for updating contents in the second storage means; PA1 addition updating means for adding the texture address stored in the first storage means to the increment stored in said second storage means, for each cycle, and for updating contents of said first storage means with a result of the addition, for each cycle; and PA1 multiplication updating means for multiplying the increment stored in the second storage means by the constant stored in said third storage means, for each cycle, and updating contents of the second storage means with a result of the multiplication, for each cycle. PA1 said second storage means comprises: PA1 said third storage means comprises: PA1 eight storage means for storing a first constant for updating contents of said sixth storage means; and PA1 ninth storage means for storing a second constant for updating contents of said seventh storage means. PA1 a random number generator for generating random numbers; PA1 addition means for adding a random number generated by the random number generator to the texture address stored in said first storage means, and outputting the results of the addition as a texture address. PA1 a first address generator for generating a texture X-address; PA1 a second address generator for generating a texture Y-address; PA1 address converting means connected to said first and second texture address generators, for generating physical addresses based on the texture X-address and the texture Y-address output from said first address generator and said second address generator, respectively; and PA1 pattern data storage means connected to the address converting means, for storing data for texture patterns and outputting data for texture patterns based on a physical address provided by the address converting means, PA1 wherein said first and second texture address generators are texture address generators as claimed in claim 1. PA1 a system bus; PA1 a processor connected to said system bus for controlling said texture drawing device; PA1 first and second texture address generators for receiving a first initial value and a constant value from said processor via said system bus, and generating a texture X-address and a texture Y-address synchronized with an input clock signal, respectively; PA1 address converting means connected to said first and second texture address generators, for generating a first physical address based on the texture X-address and the texture Y-address; PA1 a multiplexer for selecting address transferred from said processor and said address converting means; PA1 pattern data storage means for storing texture data corresponding to predetermined texture pattern data based on address selected by said multiplexer, and for outputting a part of said texture data based on a physical address provided by the address converting means selected by said multiplexer; PA1 a physical address generator for receiving a second initial value from said processor through said system bus, and for generating a second physical address synchronized with an input clock signal; PA1 a frame memory connected to said pattern data storage means, for storing said part of said texture data in a location shown by a physical address provided by said physical address generator; and PA1 display means connected to said frame memory for displaying drawing based on output from said frame memory, wherein, PA1 said first and second texture address generators are said texture address generator as claimed in claims 1. PA1 a system bus; PA1 a processor connected to said system bus for controlling said texture drawing device; PA1 first and second texture address generators for receiving a first initial value and a constant value from said processor via said system bus, and generating a texture X-address and a texture Y-address synchronized with an input clock signal, respectively; PA1 address converting means connected to said first and second texture address generators, for generating a first physical address based on the texture X-address and the texture Y-address; PA1 pattern data storage means for storing texture data corresponding to predetermined texture pattern and for outputting a part of said texture data based on a physical address provided by the address converting means via a dedicated address bus, and said dedicated bus connected between said address converting means and said address converting means and said pattern data storage means; PA1 a physical address generator for receiving a second initial value from said processor through said system bus, and for generating a second physical address synchronized with an input clock signal; PA1 a frame memory connected to said pattern data storage means, for storing said part of said texture data in a location shown by a physical address provided by said physical address generator; and PA1 display means connected to said frame memory for displaying drawing based on output from said frame memory, wherein, PA1 said first and second texture address generators are said texture address generator as claimed in claims 1. PA1 step for adding a texture address for the n-th cycle stored in a first storage register with the increment stored in a second register; PA1 step for storing the result of addition to the first register as a texture address for the (n +1)th cycle; PA1 step for multiplying the increment of the texture address for the n-th cycle by a constant stored in a third register; and PA1 step for storing the result of the multiplication to a second register as an increment of the texture address for the (n+1)th cycle.
the following relationships apply:
where R, a, d, g, b, e, h, and m are constants.
Accordingly, EQU X=(a.times.R.times.X")/(R+Z")+(d.times.R.times.Y")/(R+Z") +(g.times.R.times.Z")/(R+Z")+1 [Equation 1.1]
where a, R, d, and g are constants. EQU Y=(b.times.R.times.X")/(R+Z")+(e.times.R.times.Y")/(R+Z") +(h.times.R.times.Z")/(R+Z")+m [Equation 1.2]
where b, R, e, h, and m are constants.
Further, an approximation can be given for Z" by linear interpolation, as follows. EQU Z"=c.times.X"+f.times.Y"+n [Equation 1.3]
where c, f, and n are constants.
As a result, the relationship between the texture coordinates and the display coordinates can be shown as follows. ##EQU1## where a, c, f, n, d, R, g are constants. ##EQU2## where b, R, c, f, n, e, h are constants.
In this manner, the process of transferring coordinates from display coordinates to texture coordinates in the texture mapping process becomes a process which includes division processes shown in Equations 2.1 and 2.2 described above.
Furthermore, it is necessary to execute the above-mentioned calculation shown in Equations 2.1 and 2.2 each time one pixel is drawn and, as a result, a very large volume of calculations is required.
Because these types of processes has been conventionally handled by software, so that a great deal of time is required. For this reason it has not been possible to draw while monitoring animation implemented by the texture mapping process, in real time and is a problem.
In addition, because rather complicated calculations are necessary in the coordinate transformation process, as illustrated by the above-mentioned Equations 2.1 and 2.2, there is the inconvenience that hardware for providing these calculations becomes complicated and therefore large.